package fr.migo.quisonne.android;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;

public class QuiSonneService extends Service {

	private TelephonyManager mTelephonyManager;

	private QuiSonneListener mQuiSonneListener;
	
	@Override
	public IBinder onBind(Intent intent) {
		return null;
	}

	@Override
	public void onCreate() {
		super.onCreate();

		mQuiSonneListener=new QuiSonneListener(this);
		
		mTelephonyManager=(TelephonyManager) getSystemService(TELEPHONY_SERVICE);
		mTelephonyManager.listen(mQuiSonneListener, PhoneStateListener.LISTEN_CALL_STATE);
	}
	
	@Override
	public void onDestroy() {
		super.onDestroy();
		mTelephonyManager.listen(mQuiSonneListener, PhoneStateListener.LISTEN_NONE);
	}
}